package com.wanxi.polymorphic.model;

public class Animal {
    private String name;
    private int age;
    public int height = 10;

    public Animal() {
    }

    public void eat() {
        System.out.println("动物吃东西");
    }

//    public void eat(Cat cat) {
//        System.out.println(cat.getName() + "动物吃东西");
//    }
//
//    public void eat(Dog dog) {
//        System.out.println(dog.getName() + "动物吃东西");
//    }
    public void eat(Animal animal) {
        System.out.println(animal.getName() + "动物吃东西");
    }
    public Animal(String name, int age) {
        this.name = name;
        this.age = age;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }
}
